package com.joymart.qualification.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.joymart.common.model.Range;
import com.joymart.user.model.BusinessRole;
import com.joymart.user.model.CachedUser;
import lombok.Data;
import org.springframework.data.annotation.Transient;

/**
 *  经理的保级评估
 */
@Data
public class ManagerRetainEvaluation extends RetainEvaluation {

    private String id;
    private String userId;
    @Transient
    @JsonIgnore
    private CachedUser evaluateUser;
    private BusinessRole targetRole;
    // 评估依据区间
    private Range range;
    /**
     * 经理的保级判定和晋升判定规则是一样的
     */
    private AdvanceEvaluation advanceEvaluation;

    public ManagerRetainEvaluation(String id, AdvanceEvaluation advanceEvaluation) {
        this.id = id;
        this.advanceEvaluation = advanceEvaluation;
        this.evaluateUser = advanceEvaluation.getEvaluateUser();
        this.targetRole = advanceEvaluation.getTargetRole();
        this.range = advanceEvaluation.getRange();
        this.userId = advanceEvaluation.getUserId();
    }

    public boolean isPassed(){
        return advanceEvaluation.isPassed();
    }


}
